<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>潜在客户管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#editForm").validate();
			$("#customerStatusId").change(function(){
				customerStatusChange();
			});
			customerStatusChange();
		});

		function customerStatusChange(){
			if($("#customerStatusId").find("option:selected").data("operation")=='DONE') {
				$("#sales").show();
				$("#sales").find("input , textarea , select").removeAttr("disabled");
			} else {
				$("#sales").hide();
				$("#sales").find("input , textarea , select").attr("disabled","disabled");
			}
		}
		
		function getFormsData() {
				if (!$("#editForm").valid()) {
					return false;
				}
			return $("#editForm").serialize();
		}
	</script>
</head>
<body>
<form id="editForm" action="" method="post" class="form-horizontal">
	<div id="edit">
			<div class="control-group">
				<label class="control-label">一级来源：</label>
				<div class="controls">
					<input id="source" name="customer.source" type="text" class="input-medium" maxlength="100" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">二级来源：</label>
				<div class="controls">
					<input id="sourceDesc" name="customer.sourceDesc" type="text" class="input-medium" maxlength="100" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">来源设备：</label>
				<div class="controls">
					<select id="mobileOrPc" name="customer.mobileOrPc" class="select-medium">
						<option value="">请选择</option>
						<c:forEach items="${fns:getDictList('POTENTIAL_SOURCE')}" var="ps">
							<option value="${ps.value }">${ps}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">客户特点：</label>
				<div class="controls">
					<sys:customerFeature id="customerFeatureId" name="customer.customerFeatureId" allName="请选择"
	                                 withAll="true" cssClass="select-medium"></sys:customerFeature>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">客户类型：</label>
				<div class="controls">
					<sys:customerType id="customerTypeId" name="customer.customerTypeId" allName="请选择"
	                              withAll="true" cssClass="select-medium"></sys:customerType>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">意向产品：</label>
				<div class="controls">
					<sys:productType id="targetProducts" name="customer.targetProducts" withWu="true" allName="请选择"
	                             withAll="true" cssClass="select-medium" status="OPEN"></sys:productType>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">行业：</label>
				<div class="controls">
					<input id="industry" name="customer.industry" class="input-medium" maxlength="50" type="text" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">省份：</label>
				<div class="controls">
					<sys:region id="provinceId" name="customer.provinceId" allName="请选择"
                                 withAll="true" defaultValue="${vo.provinceId}"
                                 cssClass="select-medium"></sys:region>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">数据权重：</label>
				<div class="controls">
					<input id="weight" name="customer.weight" type="text" class="input-medium digits" data-rule-max="${fns:getUser().userWeight}" data-rule-min="0" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">联系人职务：</label>
				<div class="controls">
					<input id="contactorPosition"  name="customer.contactorPosition" class="input-medium" type="text" maxlength="50" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">创建时间：</label>
				<div class="controls">
					<input name="customer.dateCreated" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">修改时间：</label>
				<div class="controls">
					<input name="customer.lastUpdated" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">客户状态：</label>
				<div class="controls">
					 <sys:customerStatus id="customerStatusId" name="customer.customerStatusId" allName="请选择"
	                              withAll="true" cssClass="select-medium"/>
	                 <span id="spanTip" style="display:none; color: #6495ED;">提示：需要录入成单信息</span>
				</div>
			</div>
	</div>
	<div id="sales"  style="display: none">
			<div style="font-size: 14px;font-weight: bold; line-height: 30px;padding: 0px 0px 10px 80px;">成单信息</div>
			<div class="control-group">
				<label class="control-label">
					<span id="afterSalesServiceTargetProductsId_tip" style="color: red;">*</span>
					成单产品：</label>
				<div class="controls">
					<sys:productType id="saleTargetProductsId" name="afterSalesService.targetproducts" withWu="true"
									 withAll="false" cssClass="select-medium" />
				</div>
			</div>
		    <div class="control-group">
				<label class="control-label">
					<span id="year_tip" style="color: red;">*</span>
					成单年限：</label>
				<div class="controls">
					<input id="year" name="afterSalesService.year" type="text" class="input-medium required digits" data-rule-max="50" data-rule-min="1" >

				</div>
			</div>
		    <div class="control-group">
				<label class="control-label"><span id="amount_tip" style="color: red;">*</span>成单金额：</label>
				<div class="controls">
					<input id="amount" name="afterSalesService.amount" type="text" class="input-medium required digits" data-rule-max="999999999" data-rule-min="1" maxlength="9" >
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">返现：</label>
				<div class="controls">
					<input id="backCash" name="afterSalesService.backCash" type="text" class="input-medium digits" data-rule-max="999999999" data-rule-min="0" >
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">牌匾：</label>
				<div class="controls">
					<input name="afterSalesService.board" type="text" maxlength="32" class="input-medium "/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">礼品：</label>
				<div class="controls">
					<input name="afterSalesService.gift" type="text" maxlength="32" class="input-medium "/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">发票：</label>
				<div class="controls">
					<input name="afterSalesService.invoice" type="text" maxlength="32" class="input-medium "/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">电话：</label>
				<div class="controls">
					<input name="afterSalesService.phone" type="text" maxlength="32" class="input-medium " data-rule-phone="true" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">收款人：</label>
				<div class="controls">
					<input name="afterSalesService.receiver" type="text" maxlength="16" class="input-medium "/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">地址：</label>
				<div class="controls">
					<input name="afterSalesService.address" type="text" maxlength="64" class="input-medium "/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">描述：</label>
				<div class="controls">
					<textarea rows="3" cols="60" name="afterSalesService.detail" maxlength="128" class="input-medium "></textarea>
				</div>
			</div>
	</div>
</form>
</body>
</html>